<template>
  <div>
    <p>用户名<input type="text" v-model="form.username"></p>
    <p>密码<input type="text" v-model="form.password"></p>
    <button @click="btn">登录</button>
  </div>
</template>

<script>
export default {
  name: "login",
  data() {
    return {
      form: {}
    }
  },

  methods: {
    btn() {
      this.axios.post('login/', this.form).then(res => {
        if (res.data.code == 200) {
          localStorage.setItem('tid', res.data.tid)
          localStorage.setItem('tname', res.data.tname)
        }
      })
    }
  },

  mounted() {
  }
}
</script>

<style scoped>

</style>